package com.yiqi.lottery.feature.find.view;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;

import com.suozhang.framework.entity.bo.PageData;
import com.suozhang.framework.framework.BaseActivity;
import com.yiqi.lottery.R;
import com.yiqi.lottery.entity.bo.CircleBo;
import com.yiqi.lottery.entity.bo.FoucsBo;
import com.yiqi.lottery.feature.find.contract.CircleContract;
import com.yiqi.lottery.feature.find.dependencies.circle.CirclePresenterModule;
import com.yiqi.lottery.feature.find.dependencies.circle.DaggerCircleComponent;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;

public class TextActivity extends BaseActivity implements CircleContract.View {


    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.tv_text)
    TextView mTvText;
    @Inject
    CircleContract.Presenter mPresenter;
    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_text;
    }

    @Override
    protected void initInjector() {
        DaggerCircleComponent.builder().circlePresenterModule(new CirclePresenterModule(this)).build().inject(this);
    }

    @Override
    protected void initView() {
        mTvText.setMovementMethod(ScrollingMovementMethod.getInstance());
    }

    @Override
    protected void initData() {
        String content = this.getIntent().getStringExtra("text");
        String id = this.getIntent().getStringExtra("id");
        initToolBar(mToolbar,content,true,true);
        mPresenter.getFoucedDetail(id);

    }

    @Override
    public void showCircleListSuccess(PageData<CircleBo> circleBoPageData) {

    }

    @Override
    public void showCircleListMoreSuccess(PageData<CircleBo> circleBoPageData) {

    }

    @Override
    public void showCircleMoreErrorMsg(String msg) {

    }

    @Override
    public void showDetailSuccess(FoucsBo foucsBo) {
        initToolBar(mToolbar, foucsBo.getPost_content(), true, true);
        mTvText.setText(Html.fromHtml(foucsBo.getPost_files()));
    }

    @Override
    public void showCircleListError(String error) {

    }

    @Override
    public void showCircleListEmpty() {

    }

    @Override
    public void showDaiaZanSuccess(String msg) {

    }

    @Override
    public void showDaiaZanError(String msg) {

    }
}
